function Ss(ele){
    // 保存地图对象
    this.ele = ele
    this.len = 20
    this.ssObj = [
        {x:3,y:2,color:'red',ele:null},
        {x:2,y:2,color:'orange',ele:null},
        {x:1,y:2,color:'orange',ele:null}
    ]
}

Ss.prototype.remove = function(){
    for(let i =0;i<this.ssObj.length;i++)
        {
            if(this.ssObj[i].ele){
                this.ele.removeChild(this.ssObj[i].ele)
            }
            
        }
    
    }

Ss.prototype.create = function(){
    // 从地图清除蛇
    // 循环遍历
    // 创建蛇标签对象
    // 设置w h 坐标 颜色
    // 页面展示

    // 从地图清除蛇
    this.remove()
    // 循环遍历
    for(let i =0;i<this.ssObj.length;i++)
    {
        // 创建蛇标签对象
        let divObj = document.createElement('div')
        // 设置w h 坐标 颜色
        divObj.style.width = this.len+'px'
        divObj.style.height = this.len+'px'
        divObj.style.position = 'absolute'
        divObj.style.left = this.ssObj[i].x*this.len+'px'
        divObj.style.top = this.ssObj[i].y*this.len+'px'
        divObj.style.background = this.ssObj[i].color
        // 单独保存蛇节
        this.ssObj[i].ele = divObj
        // 页面展示
        this.ele.appendChild(divObj)
    }
    
}



Ss.prototype.move = function(){
    for(let i =0;i<this.ssObj.length;i++)
    {
        this.ssObj[i].x +=1
    }
    this.create()
}